<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>绑定属性</title>
</head>
<body>
  <div id="app">
    <!-- 
      如果属性的值是一个变量、 number类型、boolean类型、 对象、数组、null、undefined、正则
      那么需要使用绑定属性
    -->
    <!-- <div str="str"></div> -->
    <div v-bind:str="str"></div>
    <div :num="100"></div>
    <div :flag="true"></div>
    <div :obj="{ a: 1, b: 2 }"></div>
    <div :arr="['aaa', 'bbb', 'ccc']"></div>
    <div class="null"></div>
    <div :class="null"></div>
    <div class="undefined"></div>
    <div :class="undefined"></div>

    <div reg="/^[A-Za-z0-9]+$/"></div>
    <div :reg="/^[A-Za-z0-9]+$/"></div>
  </div>
</body>
<script src="../lib/vue.global.js"></script>
<script>
  Vue.createApp({
    data () {
      return {
        str: "字符串"
      }
    }
  }).mount('#app')
</script>
</html>